package com.jason.cloud.engine.share.driver.enterprise.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class EnterpriseUtil {

    /**
     * 根据时间长度计算过期时间
     * @param billMonthCount
     * @return
     */
    public static Date generateBillExpireDate(int billMonthCount) {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + billMonthCount);
        return cal.getTime();
    }

    /**
     * 从指定时间计算过期时间
     * @param startDate billMonthCount
     * @return
     */
    public static Date generateBillExpireDateByStartDate(Date startDate, int billMonthCount) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(startDate);
        cal.add(Calendar.MONTH, billMonthCount);
        return cal.getTime();
    }
}
